<template>
	<view class="box" @click="onClick" :style="{background:color}">
		{{num}}
	</view>
	
	<switch checked="true" @change="switchClick" />c
	
	<button type="primary" :loading="isLoading">Button</button>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	const num = ref(1);
	const color = ref("#fff000");
	const isLoading = ref(false);

	function onClick(val) {
		
		num.value++;
		color.value = "#ff" + String(Math.random()).substring(3, 7);

		console.log(val);
	}
	function switchClick(e){
		isLoading.value = !isLoading.value;
		console.log(isLoading.value);
	}
	
	
</script>

<style lang="scss">
	.box {
		width: 200rpx;
		height: 200rpx;
		background: pink;
	}
</style>